'''
Created on 29/03/2009

@author: Neper
'''
from google.appengine.api import users
from google.appengine.ext import db

# Tipo de DVD
class TbTipoDVD(db.Model):
    dsTipo = db.StringProperty(required=True)

# Genero do DVD
class TbGenero (db.Model):
    dsGenero = db.StringProperty(required=True)
        
# O proprio DVD
class TbDVD (db.Model):
    Proprietario        = db.UserProperty(required=True)
    RfTipoDvd = db.ReferenceProperty(TbTipoDVD)
    RfGenero =  db.ReferenceProperty(TbGenero)
    dsTitulo = db.StringProperty(required=True)
    dsAtorPrincipal = db.StringProperty()
    dsDiretor = db.StringProperty()
    dsSinopse = db.TextProperty()
    dsUrlTraler = db.StringProperty()
    nuDuracao = db.IntegerProperty
    nuQuantidade = db.IntegerProperty()
    nuNota = db.IntegerProperty()
    blLocado = db.BooleanProperty()

# locacao de DVD    
class TbLocacao(db.Model):
    RfDvd = db.ReferenceProperty(TbDVD)
    RfUsuario        = db.UserProperty(required=True)
    dtLocacao        = db.DateTimeProperty(auto_now=True)  
    dtDevolucao        = db.DateTimeProperty(auto_now=False)
    stLocacao = db.IntegerProperty()

# Classificacao do usuario
class TbClassificacao (db.Model):
    RfLocacao = db.ReferenceProperty(TbLocacao)
    RfUsuario        = db.UserProperty(required=True)
    tpClassificacao = db.BooleanProperty()
    dsComentario = db.TextProperty()
    dtCadastro = db.DateTimeProperty()
    
class TbComentario (db.Model):
    RfDvd = db.ReferenceProperty(TbDVD)
    RfUsuario        = db.UserProperty(required=True)
    dsComentario = db.TextProperty() 
    dtCadastro = db.DateTimeProperty()  

